home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
ca29_3.zip
/
DIALER.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-11-14
|
22KB
|
865 lines
; ----- COM-AND Multi-dialer script
;
; This script opens a window and asks for up to 10 dialing directory
; numbers (with or without long distance prefix). As numbers are
; selected, the dialing directory values are displayed (and the dialing
; directory may be cycled through, searching).
;
; When dialing is initiated, the current selections are saved to a file
; on the current drive/subdirectory named DIALER.DAT. If a connection
; is made, the DIALER.DAT is updated to eliminate the connection just
; made from the list.
;
; If a script is associated with the dialing directory entry to which
; connection is made, it is EXECUTED just as if from Alt-D.
;
; R.McG, commenced 10/88
; updated 3/89 (CLOG start and hit, and add alarm)
; updated 10/92 (Fixes; changed for area code strip, dd changes)
; ----- Usages -----------------
; S19 -----> Parameter string read/written to the .DAT file
; N8 ------> Saved cursor row #
; N9 ------> Saved cursor col #
; N10-N19 -> Working storage for the screen display (LD# and DD#)
; ------------------------------
; Initialization
;
;* TRACE ON
CLEAR
CURSOR N8,N9 ; Save cursor on entry
ON ESCAPE GOSUB Exit ; SAVE is performed in Window
LEGEND " Multi-dialer pop-up"
SET TTHRU OFF ; Disallow typeahead
CLOG "* Dialer multi-dialer invoked"
;
; Paint an initial window, using saved values
;
GOSUB Window ; Open the window
GOSUB Get_Last ; Get last Parm string
GOSUB Parse_Parm ; Parse_Parms
GOSUB All_Fields ; Display all fields
LOCATE 7,8 ; Set cursor to 1st entry
;
; Main-loop - look for keyentry
;
Main_Loop:
SET TTHRU OFF ; Disallow typeahead
KEYGET S0 ; Get a keystroke
;
; Act upon the keystroke
;
Have_Key:
SWITCH S0
CASE "4900" ; Pgup
GOTO PgUp
ENDCASE
CASE "5100" ; PgDn
GOTO PgDn
ENDCASE
CASE "4700" ; Home
GOTO Home
ENDCASE
CASE "4F00" ; End
GOTO End
ENDCASE
CASE "0D" ; C/r
GOTO Perform
ENDCASE
CASE "4800" ; Cursor up
GOTO UpLine
ENDCASE
CASE "5000" ; Cursor down
GOTO DnLine
ENDCASE
CASE "4B00" ; Cursor Left
GOTO Left
ENDCASE
CASE "4D00" ; Cursor right
GOTO Right
ENDCASE
CASE "09" ; Tab
GOTO Right
ENDCASE
CASE "0F00" ; Shift-tab
GOTO Left
ENDCASE
ENDSWITCH
;
; Any other keystrokes must be ASCII keys
;
IF NOT NULL S0(1:3)
SOUND 100,100
GOTO Main_Loop
ENDIF
;
; Decide where we are by the current cursor, and begin field entry
;
CURSOR N0,N1
IF GE N1 11
GOSUB Enter_DD ; Enter dialing directory #
GOTO Have_Key ; Return with a new keystroke
ELSE
GOSUB Enter_LD ; Enter Long distance #
GOTO Right ; Move to next field
ENDIF
;
; ----- Page up (cycle backwards through possible values)
;
PgUp:
CURSOR N1,N2
IF GE N2 11
N0 = N10[N1-7]
N3 = N0/1000 ; Cycle DD#
N0 = N0-(N0/1000)*1000
N0 = N0-1
IF LT N0 0 N0 = 100
N0 = N0+N3*1000
ELSE
N0 = N10[N1-7]
N3 = N0-(N0/1000)*1000 ; Cycle LD#
N0 = N0/1000
N0 = N0-1
IF LT N0 0 N0 = 4
N0 = N3+N0*1000
ENDIF
;
; Restore the value (N0, index N1) and display
;
N10[N1-7] = N0
GOSUB One_Field
GOTO Main_Loop
;
; ----- Page down (cycle forwards through possible values)
;
PgDn:
CURSOR N1,N2
IF GE N2 11
N0 = N10[N1-7]
N3 = N0/1000 ; Cycle DD#
N0 = N0-(N0/1000)*1000
N0 = N0+1
IF GT N0 100 N0 = 0
N0 = N0+N3*1000
N10[N1-7] = N0
GOSUB One_Field
ELSE
N0 = N10[N1-7]
N3 = N0-(N0/1000)*1000 ; Cycle LD#
N0 = N0/1000
N0 = N0+1
IF GT N0 4 N0 = 0
N0 = N3+N0*1000
ENDIF
;
; Restore the value (N0, index N1) and display
;
N10[N1-7] = N0
GOSUB One_Field
GOTO Main_Loop
;
; ----- Up a line
;
UpLine:
CURSOR N0,N1
N0 = N0-1
IF LT N0 7 N0 = 16
N1 = 8 ; Set new start-of-field
IF GE N1 11 N1 = 11 ; Set new start-of-field
LOCATE N0,N1
GOTO Main_Loop
;
; ----- Down a line
;
DnLine:
CURSOR N0,N1
N0 = N0+1
IF GT N0 16 N0 = 7
N1 = 8 ; Set new start-of-field
IF GE N1 11 N1 = 11
LOCATE N0,N1
GOTO Main_Loop
;
; ----- Home (move to first line)
;
Home:
LOCATE 7,8
GOTO Main_Loop
;
; ----- End (Move to last line)
;
End:
LOCATE 11,8
GOTO Main_Loop
;
; ----- Left (Next field)
;
Left:
CURSOR N0,N1
IF GE N1 11
N1 = 8 ; Move to previous field
ELSE
N0 = N0-1 ; Move to previous line
N1 = 11
ENDIF
IF LT N0 7 N0 = 16 ; Last field
LOCATE N0,N1 ; And reposition cursor
GOTO Main_Loop
;
; ----- Right (Previous field)
;
Right:
CURSOR N0,N1
IF GE N1 11
N0 = N0+1 ; Move to next row
N1 = 8
ELSE
N1 = 11 ; Move to next field
ENDIF
IF GT N0 16 N0 = 7 ; Last field
LOCATE N0,N1 ; And reposition cursor
GOTO Main_Loop
;
; ----- Subroutine Exit - terminate the process
;
Exit:
RESTORE ; Saved screen
LOCATE N8,N9 ; Restore cursor
EXIT
;
; ----- Subroutine: Enter a dialing directory #
; .. on entry S0 -> The first keystroke
; .. N1 within this subroutine is always current row#
; .. S9 within this subroutine the field being constructed
; .. N6 within this subroutine is an index to field being constructed
;
Enter_DD:
CURSOR N1,N2 ; Get current row
N0 = N10[N1-7]
N0 = (N0/1000)*1000 ; Fake a 0 DD# with old LD#
GOSUB One_Field ; Clear previous values on screen
N6 = 0 ; Index to field being built
S9 = "" ; Clear field
;
; Look for an initial space or backspace (this 'blank's the field)
;
IF STRCMP S0 " " ; If enter with space
N10[N1-7] = N0
GOTO DD_Keypress ; Start w/new key
ENDIF
IF STRCMP S0 "08" ; If enter with backspace
N10[N1-7] = N0
GOTO DD_Keypress ; Start w/new key
ENDIF
;
; The space bar terminates data entry
;
DD_Test:
IF STRCMP S0 " " ; If space key
S0 = "4D00" ; Fake a cursor right
GOTO DD_Store ; End of routine
ENDIF
;
; A "?" pops up the dialing directory
;
IF STRCMP S0 "?" ; If enter with backspace
GOSUB Ask_Dial ; Display dialing directory
IF SUCCESS ; If an entry selected..
S9 = S2 ; Move to accumulator string
LENGTH S9 N6 ; Length of entry
S0 = "4D00" ; Fake a cursor right
GOTO DD_Store ; ANd use it
ENDIF
GOTO DD_Keypress ; Else start over
ENDIF
;
; Look for special chars (tab, and backspace, and non-ASCII)
;
SWITCH S0
CASE "09" ; Tab key
GOTO DD_Store
ENDCASE
CASE "0D" ; Carriage rtn end field here
S0 = "4D00" ; Fake a cursor right
GOTO DD_Store
ENDCASE
CASE "08" ; Backspace
IF GT N6 0 ; If anything entered
CURSOR N1,N2
N2 = N2-1
LOCATE N1,N2
ATSAY N1,N2 (default) " "
S1(N6:N6) = " "
N6 = N6-1
ENDIF
GOTO DD_Keypress ; And go for another key
ENDCASE
ENDSWITCH
IF NOT NULL S0(1:3) GOTO DD_Store ; Not ascii key
;
; Filter only numeric chars here
;
CTOI S0 N0 ; Easier comparison
IF LT N0 48 GOTO DD_Invalid ; 48 = '0'
IF GT N0 57 GOTO DD_Invalid ; 56 = '9'
;
; Add the character to our field being constructed
;
S9(N6:N6) = S0 ; Add the char
N6 = N6+1
;
; Display the keystroke in S0
;
CURSOR N1,N2
ATSAY N1,N2 (d